package com.gh.rabbitmq.utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

/**
 * @Author Eric
 * @Date 2021/7/17 16:51
 * @Version 1.0
 */
public class RabbitmqUtils {
    public static Channel getChannel() throws Exception{
        ConnectionFactory factory=new ConnectionFactory();
        //设置ip 用户名 密码
        factory.setHost("192.168.1.11");
        factory.setUsername("guest");
        factory.setPassword("guest");
        //创建连接
        Connection connection=factory.newConnection();
        //创建信道
        Channel channel = connection.createChannel();
        return channel;
    }
}
